PROJECT(ameletHDFReader)
FIND_LIBRARY(AMELETHDF_HDF5_HL_LIBRARY libhdf5_hl.so
  /usr/local/lib
  /usr/lib
)

FIND_PATH(AMELETHDF_HDF5_HL_INCLUDE_DIR hdf5_hl.h
  /usr/local/include
  /usr/include
)

FIND_LIBRARY(AMELETHDF_LIBRARY libamelethdf.a
  /usr/local/lib
  /usr/lib
)

FIND_PATH(AMELETHDF_INCLUDE_DIR amelethdf.h
  /usr/local/include
  /usr/include
)

IF(AMELETHDF_HDF5_HL_INCLUDE_DIR)
  IF(AMELETHDF_HDF5_HL_LIBRARY)
    SET( AMELETHDF_HDF5_HL_LIBRARY ${AMELETHDF_HDF5_HL_LIBRARY} )
    SET( AMELETHDF_HDF5_HL_INCLUDE_DIR ${AMELETHDF_HDF5_HL_INCLUDE_DIR} )
    SET( AMELETHDF_HDF5_HL_FOUND "YES" )
  ENDIF(AMELETHDF_HDF5_HL_LIBRARY)
ENDIF(AMELETHDF_HDF5_HL_INCLUDE_DIR)

IF(AMELETHDF_INCLUDE_DIR)
  IF(AMELETHDF_LIBRARY)
    SET( AMELETHDF_LIBRARY ${AMELETHDF_LIBRARY} )
    SET( AMELETHDF_INCLUDE_DIR ${AMELETHDF_INCLUDE_DIR} )
    SET( AMELETHDF_FOUND "YES" )
  ENDIF(AMELETHDF_LIBRARY)
ENDIF(AMELETHDF_INCLUDE_DIR)


# This is just a simple variable that lists the source files.
SET(SRCS
  vtkAmeletHDFReader.cxx
  )


IF(PARAVIEW_BUILD_QT_GUI)
  ADD_PARAVIEW_PLUGIN(ameletHDFReader "0.1"
    SERVER_MANAGER_SOURCES ${SRCS}
    SERVER_MANAGER_XML ameletHDFReaderSM.xml
    GUI_RESOURCE_FILES ameletHDFReaderGUI.xml
  )
ELSE(PARAVIEW_BUILD_QT_GUI)
  ADD_PARAVIEW_PLUGIN(ameletHDFReader "0.1"
    SERVER_MANAGER_SOURCES ${SRCS}
    SERVER_MANAGER_XML ameletHDFReaderSM.xml
  )
ENDIF(PARAVIEW_BUILD_QT_GUI)

INCLUDE(${QT_USE_FILE})

INCLUDE_DIRECTORIES(
  ${VTK_INCLUDE_DIR}
  ${PARAVIEW_INCLUDE_DIRS}
  ${PARAVIEW_GUI_INCLUDE_DIRS}
  ${VTKCLIENTSERVER_INCLUDE_DIR}
  ${PVSERVERCOMMON_INCLUDE_DIR}
  ${AMELETHDF_HDF5_HL_INCLUDE_DIR}
  ${AMELETHDF_INCLUDE_DIR}
  ${CMAKE_CURRENT_SOURCE_DIR}/ameletHDFReader
  )


# We need to add library dependencies for the plugin.
ADD_SUBDIRECTORY(ahdfreaders) 

MESSAGE("amelethdf lib is  ${AMELETHDF_LIBRARY}")
TARGET_LINK_LIBRARIES(ameletHDFReader
  amelethdf_readers
  ${AMELETHDF_LIBRARY}
  ${AMELETHDF_HDF5_HL_LIBRARY}
  )
